package fr.afcepf.ai85.ent;

// Generated 21 mars 2013 17:20:56 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Connexion generated by hbm2java
 */
@Entity
@Table(name = "connexion", catalog = "gepeto_db")
public class Connexion implements java.io.Serializable {

	private Integer idConnexion;
	private TypeConnexion typeConnexion;
	private String login;
	private String motDePasse;
	private Set<Ecole> ecoles = new HashSet<Ecole>(0);
	private Set<PersonnelMairie> personnelMairies = new HashSet<PersonnelMairie>(
			0);
	private Set<Eleve> eleves = new HashSet<Eleve>(0);

	public Connexion() {
	}

	public Connexion(TypeConnexion typeConnexion) {
		this.typeConnexion = typeConnexion;
	}

	public Connexion(TypeConnexion typeConnexion, String login,
			String motDePasse, Set<Ecole> ecoles,
			Set<PersonnelMairie> personnelMairies, Set<Eleve> eleves) {
		this.typeConnexion = typeConnexion;
		this.login = login;
		this.motDePasse = motDePasse;
		this.ecoles = ecoles;
		this.personnelMairies = personnelMairies;
		this.eleves = eleves;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID_CONNEXION", unique = true, nullable = false)
	public Integer getIdConnexion() {
		return this.idConnexion;
	}

	public void setIdConnexion(Integer idConnexion) {
		this.idConnexion = idConnexion;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_TYPE_CONNEXION", nullable = false)
	public TypeConnexion getTypeConnexion() {
		return this.typeConnexion;
	}

	public void setTypeConnexion(TypeConnexion typeConnexion) {
		this.typeConnexion = typeConnexion;
	}

	@Column(name = "LOGIN", length = 20)
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column(name = "MOT_DE_PASSE", length = 20)
	public String getMotDePasse() {
		return this.motDePasse;
	}

	public void setMotDePasse(String motDePasse) {
		this.motDePasse = motDePasse;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "connexion")
	public Set<Ecole> getEcoles() {
		return this.ecoles;
	}

	public void setEcoles(Set<Ecole> ecoles) {
		this.ecoles = ecoles;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "connexion")
	public Set<PersonnelMairie> getPersonnelMairies() {
		return this.personnelMairies;
	}

	public void setPersonnelMairies(Set<PersonnelMairie> personnelMairies) {
		this.personnelMairies = personnelMairies;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "connexion")
	public Set<Eleve> getEleves() {
		return this.eleves;
	}

	public void setEleves(Set<Eleve> eleves) {
		this.eleves = eleves;
	}

}
